﻿<?php
require_once "common.php";
	//function __autoload($className){
		//require_once("class_".ucfirst($className).".php");
	//}
	$weight=$_POST['weight'];
	$pid=$_POST['pid'];
	$part= new part($pid,'','');
	$partList=$part->showPart();
	//echo count($partList);
?>
<table>
<tr style="background-color:#4682B4;color:white;font-weight:700;">
	<td align='center' width='40'>排序</td>
	<td align='center' width='100'>栏目编号</td>
	<td align='center' width='150'>栏目标题</td>
	<td align='center' width='80'>顶级栏目</td>
	<td align='center' width='80'>操作</td>
</tr>
<?php
	for($i=0;$i<count($partList)-1;$i++){
		echo "<form action=\"\" method=\"POST\">";
		if(fmod($i,2)==0){
			echo "<tr style=\"background-color:#00bfff;font-weight:700;\">";
		}else{
			echo "<tr style=\"background-color:#B0E0E6;font-weight:700;\">";
		}
		echo "<td align='center'>
			".$partList[$i][weight]."
			&nbsp<input type=text name=weight text=2 value=\"\" style=\"width:30px;text-align:center;\"></input>
			<input type=hidden name=pid text=2 value=\"".$partList[$i][pid]."\"></input>
			</td>";
		echo "<td align='center' style=\"color:yellow;\">".$partList[$i][pid]."</td>";
		echo "<td align='center'>".$partList[$i][part]."</td>";
		echo "<td align='center'>".$partList[$i][top]."</td>";
		echo "<td align='center'><a href='./part_edit.php?pid=".$partList[$i][pid]."'>编辑</a>|<a href='./part_del.php?pid=".$partList[$i][pid]."'>删除</a>&nbsp<input type=\"submit\" name=\"submit\" value=\"修改排序\"></input></td>";
		echo "</tr>";
		echo "</form>";
	}
?>
</table>
<?php
	//$weight=$_REQUIRE[weight];
	if($weight!=""&&$pid!=""){
		$res=$part->editpart('weight',$weight);
		if($res==true){
			echo "<script>alert('修改成功！');</script>";
		}
	}
?>
<div style="font-family:Simsun;color:red;font-size:14px;">排序只对顶级栏目有效，序号越小，顺序越靠前。</div>